//
//  AddOptional.m
//  DaiShengInvest
//
//  Created by 张睿 on 2017/7/27.
//  Copyright © 2017年 davinci. All rights reserved.
//

#import "AddOptional.h"

@implementation AddOptional



+(instancetype)modelWithDictionary:(NSDictionary *)dic{
    
    AddOptional *model =[[AddOptional alloc] init];
    
    [model setValuesForKeysWithDictionary:dic];
    
    return model;
}


+(void)addOptionalWithSucess:(void (^)(NSArray<AddOptional *> *))sucessBlock error:(void (^)())errorBlock{
    
//    NSDictionary * parameters = @{@"page":@"1",@"size":@"500"};
    
    [[NetworkTool sharedTools] POST:@"symbols/index?page=1&size=500" parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, NSDictionary *  _Nullable responseObject) {
        
        NSArray * paramArray = responseObject[@"param"];
        
//        NSLog(@"==%@",paramArray);
        
        NSMutableArray *mArray = [NSMutableArray array];
        
        [paramArray enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            
            AddOptional * model = [AddOptional modelWithDictionary:obj];
            
            [mArray addObject:model];
            
        }];
        
        if(sucessBlock){
            sucessBlock(mArray.copy);
        }
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
    }];
    
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
}



@end
